import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

/* 

vue router 报错： Uncaught (in promise) NavigationDuplicated {_name:""NavigationDuplicated"... 的解决方法
解决方法也很简单，在项目目录下运行 npm i vue-router@3.0 -S 即可.
如果不想换 vue-router 的版本 或者 还是 没有用，那么可以用以下方法
在main.js下添加一下代码：

*/
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch((err) => err);
};

let Routes = [{
        path: "/",
        name: "home",
        component: () =>
            import ( /* webpackChunkName:'home' */ "../views/home.vue"),
        meta: {
            title: "home",
        },
    },
    {
        path: "/test",
        name: "test",
        component: () =>
            import ( /* webpackChunkName:'test' */ "../views/test/test.vue"),
        meta: {
            title: "test",
        },
    },
    {
        path: "/login",
        name: "login",
        component: () =>
            import ( /* webpackChunkName:'login' */ "../views/login/login.vue"),
        meta: {
            title: "login",
        },
    },
    {
        path: "/adminWorkOrder",
        name: "adminWorkOrder",
        component: () =>
            import (
                /* webpackChunkName:'adminWorkOrder' */
                "../views/workOrder/adminWorkOrder.vue"
            ),
        meta: {
            title: "adminWorkOrder",
        },
    },
    {
        path: "/historyWorkOrder",
        name: "historyWorkOrder",
        component: () =>
            import (
                /* webpackChunkName:'historyWorkOrder' */
                "../views/workOrder/historyWorkOrder.vue"
            ),
        meta: {
            title: "historyWorkOrder",
        },
    },
    {
        path: "/sysConfig",
        name: "sysConfig",
        component: () =>
            import (
                /* webpackChunkName:'sysConfig' */
                "../views/config/sysConfig.vue"
            ),
        meta: {
            title: "sysConfig",
        },
    },
    {
        path: "/editWorkOrder",
        name: "editWorkOrder",
        component: () =>
            import (
                /* webpackChunkName:'sysConfig' */
                "../views/workOrder/editWorkOrder.vue"
            ),
        meta: {
            title: "editWorkOrder",
        },
    },
];

export default new VueRouter({
    routes: Routes,
});